<!DOCTYPE HTML>
<html>
<head>
  <title>编辑用户属性</title>
  <link rel="stylesheet" href="/stylesheets/style.css">
  <script src="/scripts/jquery.min.js"></script>
  <script src="/scripts/boot.js" type="text/javascript"></script>
  <link rel="stylesheet" href="/scripts/miniui/themes/default/miniui.css">
  <link rel="stylesheet" href="/scripts/miniui/themes/icons.css">
  <link rel="stylesheet" href="/scripts/miniui/themes/bootstrap/skin.css">
  <link rel="stylesheet" href="/editor/common.css">
  <script src="/scripts/miniui/miniui.js"></script>

</head>
<body>
<div style="margin-bottom: 20px;">
  <div style="width:100%;text-align: center;margin-bottom: 10px">
    <span style="width:100%;text-align: center">名称：</span>
    <input id="name" class="mini-textbox" style="width:155px;" value="<%= result.name%>" />
  </div>
  <div style="width:100%;text-align: center;margin-bottom: 10px">
    <span style="width:100%;text-align: center">类别：</span>
    <input id="category" class="mini-textbox" value="<%= result.category%>" style="width:155px;"/>
  </div>
  <div style="width:100%;text-align: center;margin-bottom: 10px">
    <span style="width:100%;text-align: center">表名：</span>
    <input id="tableField" class="mini-textbox" value="<%= result.tableField%>" style="width:155px;"/>
  </div>

  <div style="width:100%;text-align: center">
    <span style="width:100%">类型：</span>
    <input id="type" class="mini-combobox"  data="userIdentifyPropType" value="<%= result.type%>"style="width:155px;"/>
  </div>
</div>
<div style="text-align: center">
  <a class="mini-button " iconCls="icon-ok" onclick="userIdentifyPropUpdate()">确定</a>
  <a class="mini-button" iconCls="icon-cancel" onclick="onCancel">取消</a>
</div>
</body>
<script>
  var userIdentifyPropType = [{ id: 0, text: '用户输入' }, { id: 1, text: '选项选择'}];
  var objectId ='<%= result.objectId%>'
  mini.parse();
  function userIdentifyPropUpdate(){
    let name = mini.get("name").getValue();
    let category = mini.get("category").getValue();
    let tableField = mini.get("tableField").getValue();
    let type = mini.get("type").getValue();
    if (!name || name == ''){
      alert('请输入名字！')
      return
    } else if (!type || type == ''){
      alert('请输入类型！')
      return
    } else if (!tableField || tableField == ''){
      alert('请输入表名！')
      return
    } else if (!category || category == ''){
      alert('请输入类别！')
      return
    }else {
      $.ajax({
        type:"POST",
        url:"/getdata/userIdentifyPropUpdate",
        data:{
          objectId:objectId,
          name:name,
          category:category,
          tableField:tableField,
          type:type,
        },
        success:function (result) {

          CloseWindow("save");
        }
      })
    }
  };
  //    关闭窗口
  function CloseWindow(action) {
    if (action == "close" && form.isChanged()) {
      if (confirm("数据被修改了，是否先保存？")) {
        return false;
      }
    }
    if (window.CloseOwnerWindow) return window.CloseOwnerWindow(action);
    else window.close();
  }
  function onOk(e) {
    SaveData();
  }
  function onCancel(e) {
    CloseWindow("cancel");
  }

</script>
</html>